<style type="text/css">
	.m-main-z .form_z{
		padding-top:10px;
		width: 980px;
		float: left;
	}

	.m-main-z .pass-message{
		text-indent:10px;
		width: 980px;
		float: left;
	}
</style>

<div class="m-main-z">

	<div class="pass-message">
		<volist name="listdb" id="rs">
			<p>{$rs.nickname} {$rs.starttime|friendly_time}</p>
            <p>{$rs.content|parse_content}</p>
            
            <if condition="$rs.r_content neq null">
            
			<p><font color="red">管理员回复：{$rs.r_content|parse_content}</font></p>
            
            </if>
            <br />
			
		</volist>
	</div>
    
    <div class="form_z">
		<form id="guestbook-form" method="post" action="{:addons_url('Guestbook://Guestbook/post_message')}" class="form-horizontal">
		  <div class="control-group">
		    <label class="control-label" for="inputText">昵称</label>
		    <div class="controls">
		      <input type="text" name="name" placeholder="您的称呼">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="inputText">联系方式</label>
		    <div class="controls">
		      <input type="text" name="contact" placeholder="QQ,电话,邮箱">
		    </div>
		  </div>

		   <div class="control-group">
		       <label class="control-label" for="inputText" >留言内容</label>
		    <div class="controls">
		      <textarea name="content" rows="3" placeholder="你想说的"></textarea>
		    </div>
		    
		   </div>

		 
		  <div class="control-group">
		    <div class="controls">
		      <button type="submit" class="btn">提交</button>
		    </div>
		  </div>
		</form>
	</div>
</div>

<script>
    $(function () {
				
        $('#guestbook-form').submit(function () {
											  
			var data={};
											  
			data['name']=$('#guestbook-form input[name=name]').val();
			
			data['contact']=$('#guestbook-form input[name=contact]').val();
			
			data['content']=$('#guestbook-form textarea[name=content]').val();
										  
            if (!data['content']) {
                
				$.zui.messager.danger('请输入留言',{placement:'center'});
				
            }else {
				
                $.post($(this).attr("action"),data, function (res) {
                    if (res.status) {
                      $.zui.messager.success("留言成功",{placement:'center'});
                    } else {
                      $.zui.messager.danger(res.info,{placement:'center'});
                    }
                });
				
            }
			
			return false;

        });
		
    })


</script>